﻿using AutoMapper;
using DFGK.IRepository.LY;
using DFGK.IService.LY;
using DFGK_WMS.Model.Models.LyModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DFGK.Service.LY
{
    public class ProcurementCostAnalysisService : BaseService, IProcurementCostAnalysisService
    {
        private readonly IProcurementCostAnalysisRepository _procurementCostAnalysis;
        public ProcurementCostAnalysisService(IMapper mapper, IProcurementCostAnalysisRepository procurementCostAnalysis) : base(mapper)
        {
            _procurementCostAnalysis = procurementCostAnalysis;
        }

        public List<ProcurementCostAnalysis> GetProcurementCostAnalysis(out int totalCount, int pageIndex = 1, int pageSize = 15)
        {
            var list = _procurementCostAnalysis.GetEntityAlls();

            totalCount = list.Count();
            list = list.Skip((pageIndex - 1) * pageSize).Take(pageSize).OrderByDescending(d => d.Id);
            return list.ToList();
        }
    }
}
